<template>
    <el-form slot="form" :inline="true" size="medium">
        <el-form-item label="事件类型">
            <el-select v-model="listQuery.type" clearable placeholder="请选择">
                <el-option v-for="(value, key) in EventTypes" :key="key" :label="value" :value="key" />
            </el-select>
        </el-form-item>
        <el-form-item label="事发时间">
            <el-date-picker v-model="listQuery.trafficTime" type="date" placeholder="选择日期时间" clearable value-format="yyyy-MM-dd" />
        </el-form-item>
        <el-form-item>
            <BaseButton v-permission="{ btnCode: 'dlyh_c11_d34_2' }" @click="handleFilter">查询</BaseButton>
            <BaseButton type="second" @click="resetConditions">重置</BaseButton>
        </el-form-item>
    </el-form>
</template>
<script>
import { EventTypes } from '@/views/maintenance-decision/constants'
import { ResetTable } from '@/mixins/keepAliveHandler'

export default {
    mixins: [
        ResetTable({
            defaultCondition: {
                type: null,
                trafficTime: null
            },
            filterName: 'filter'
        })
    ],
    data() {
        return {
            EventTypes,
            listQuery: {
                type: null,
                trafficTime: null
            }
        }
    },
    methods: {
        handleFilter() {
            this.$emit('filter', this.listQuery)
        }
    }
}
</script>
